package com.zyb.eduservice.controller.consumer;

import com.zyb.commonutils.R;
import com.zyb.eduservice.entity.EduCourse;
import com.zyb.eduservice.entity.EduTeacher;
import com.zyb.eduservice.service.EduCourseService;
import com.zyb.eduservice.service.EduTeacherService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;

@RestController
//@CrossOrigin
@RequestMapping("/eduservice/indexConsumer")
public class IndexConsumerController {

    @Resource
    private EduCourseService courseService;
    @Resource
    private EduTeacherService teacherService;

    @GetMapping("index")
    public R index() {
        //查询前8条热门课程
        List<EduCourse> courseList = courseService.cmsQueryCourse();
        //查询前4条名师
        List<EduTeacher> teacherList = teacherService.cmsQueryTeacher();
        return R.ok().data("courseList", courseList).data("teacherList", teacherList);
    }
}
